﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace engine
{
    static class Settings
    {
        static public Dictionary<string, float> Var = new Dictionary<string,float>();                                  // Dictionary definition, wich keys are string variables and values are floats.
        public static string[] cache;
        static private string line;                                                                                    
        static private System.IO.StreamReader file = new System.IO.StreamReader("Content/Settings/settings.txt");     //Read the file
        static string[] whitespace;                                                                                    // Empty table wich uhm... holds nothing, but makes the Split method work, while it refused to work with a single char variable containing the SPACEBAR code. 
              
        static public void ReadVars()
        {
            while((line = file.ReadLine()) != null)
            {

                cache = line.Split(whitespace, StringSplitOptions.RemoveEmptyEntries);          // Split the line up into 2 seperate strings, one being the key and the other a variable associated with it and temporarly store them in an array.
                Var.Add(cache[0], float.Parse((cache[1])));                                     // Add the key and value to a dictionary in order to make the access fast and simple.

                
            }
            file.Close();
        }
        


    }
}
